<!-- MRCH03（团体项目综合成绩） -->
<template>
  <div>
    <div class="item-info">
      <div
        :class="['single-item', item.flag ? 'active-item' : '']"
        v-for="(item, index) in singleItemList"
        :key="index"
      >
        <div>{{ item.name }}</div>
        <div class="item-logo">
          <img :src="item.logo" alt="" />
        </div>
      </div>
      <div class="single-item-info">
        <div class="info-line1">
          <div>{{ gameTitle }}</div>
          <div class="venue">{{ venueName }}</div>
        </div>
        <div class="info-line2">
          <div class="report-name">综合成绩公告</div>
          <div>{{ gameTime }}</div>
        </div>
      </div>
    </div>
    <div class="score-table-data" style="width: 100%;">
      <el-table
        :data="reportData"
        style="width: 100%"
        stripe
        border
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
      >
        <template v-for="(item, index) in tableHeader">
          <div>
            <el-table-column :label="item.label" :prop="item.prop"> </el-table-column>
          </div>
        </template>
      </el-table>
    </div>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  created() {
    this.venueName = this.$route.query.venueName
    this.gameTime = this.$route.query.gameTime
    this.gameTitle = this.$route.query.gameTitle
    this.filePath = this.$route.query.filePath
    this.getReportData()
  },
  props: {},
  data() {
    return {
      tableHeader: [
        { prop: 'Rank', label: '名次' },
        { prop: 'Team', label: '单位' },
        { prop: 'MatchCount', label: '比赛数' },
        { prop: 'WinCount', label: '胜场数' },
        { prop: 'LostCount', label: '负场数' },
        { prop: 'TieCount', label: '平场数' },
        { prop: 'MatchScore', label: '场分' },
        { prop: 'Score', label: '局分' },
        { prop: 'SB', label: '索伯分' }
      ],
      tableData: [
        {
          RANK: '1 ',
          TEAM: '2',
          MatchCount: '杨一',
          WinCount: '河北',
          LostCount: '0',
          TieCount: '0',
          MatchScore: '22', //对手
          Score: '2', //局
          SB: '1'
        }
      ],
      filePath: '',
      venueName: '',
      gameTime: '',
      gameTitle: '',
      singleItemList: [
        {
          name: '国际象棋',
          logo: require('@/assets/img/daily/CH.png'),
          flag: true
        }
      ]
    }
  },
  watch: {},
  computed: {
    ...mapState({
      reportData: state => state.schedule.reportData
    })
  },
  filters: {},
  components: {},
  methods: {
    getReportData() {
      this.$store
        .dispatch('getReportData', this.filePath + '.txt')
        .then(_ => {})
        .catch(error => {
          console.log(error)
        })
    }
  }
}
</script>
<style scoped lang="scss">
@import '@/assets/scss/item.scss';
</style>
